package cn.cheln.explorer.ds.uri;

import android.content.Context;
import android.os.Environment;
import cn.cheln.explorer.beans.FileInfo;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

public class NavigationPool
{
  public Stack<NavigationNode> navEntity = new Stack();

  public NavigationNode backForward(int paramInt)
  {
    for (int i = -1 + this.navEntity.size(); ; --i)
    {
      if (i <= paramInt)
        return ((NavigationNode)this.navEntity.pop());
      this.navEntity.pop();
    }
  }

  public NavigationNode backward(int paramInt)
  {
    while (true)
    {
      if (paramInt <= 0)
        return ((NavigationNode)this.navEntity.peek());
      this.navEntity.pop();
      --paramInt;
    }
  }

  public Object getCurrNavEntitySource()
  {
    if (!(this.navEntity.isEmpty()))
      return ((NavigationNode)this.navEntity.peek()).producingSource;
    return null;
  }

  public String getShowText()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append(((NavigationNode)this.navEntity.get(0)).displayname);
    if (this.navEntity.size() < 2)
      return localStringBuilder.toString();
    for (int i = 1; ; ++i)
    {
      if (i >= this.navEntity.size())
        return localStringBuilder.toString();
      localStringBuilder.append(" / " + ((NavigationNode)this.navEntity.get(i)).displayname);
    }
  }

  public boolean isAtTop()
  {
    return (this.navEntity.size() <= 1);
  }

  public void pop()
  {
    if (this.navEntity.isEmpty())
      return;
    this.navEntity.pop();
  }

  public void push(NavigationNode paramNavigationNode)
  {
    if ((this.navEntity.size() == 1) && (paramNavigationNode.displayname.equals(NavigationConstants.SDCARD)) && (((NavigationNode)this.navEntity.peek()).displayname.equals(NavigationConstants.SDCARD)));
    do
      return;
    while ((this.navEntity.size() == 1) && (NavigationConstants.CATEGORYHOME.equals(paramNavigationNode.displayname)) && (NavigationConstants.CATEGORYHOME.equals(((NavigationNode)this.navEntity.peek()).displayname)));
    this.navEntity.push(paramNavigationNode);
  }

  public void pushSerial(SDCardNode paramSDCardNode, Context paramContext)
  {
    ArrayList localArrayList = new ArrayList(0);
    SDCardNode localSDCardNode = paramSDCardNode;
    File localFile = ((FileInfo)localSDCardNode.producingSource).getFile();
    if ((localFile.getAbsolutePath().equals(Environment.getExternalStorageDirectory().getAbsolutePath())) || (localFile.getAbsolutePath().equals("/mnt")) || (localFile.getAbsolutePath().equals("/")))
    {
      this.navEntity.clear();
      this.navEntity.push(new SDCardNode(new FileInfo(localFile, paramContext), NavigationConstants.SDCARD));
    }
    for (int i = -1 + localArrayList.size(); ; --i)
    {
      if (i <= 0)
      {
        return;
        localArrayList.add(localSDCardNode);
        localSDCardNode = new SDCardNode(new FileInfo(localFile.getParentFile(), paramContext), 0);
      }
      this.navEntity.push((NavigationNode)localArrayList.get(i));
    }
  }

  public String toString()
  {
    String str = "NavigationPool{navEntity=";
    for (int i = 0; ; ++i)
    {
      if (i >= this.navEntity.size())
        return str;
      str = str + ((FileInfo)((NavigationNode)this.navEntity.get(i)).producingSource).path + "}\n";
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.explorer.ds.uri.NavigationPool
 * JD-Core Version:    0.5.2
 */